package com.solution.delegate;

import java.util.List;

import com.solution.exception.DelegateException;
import com.solution.exception.ServiceBeanException;
import com.solution.exception.ServiceLocatorException;
import com.solution.model.UserPermissionType;
import com.solution.model.UserRolePermission;
import com.solution.model.UserRoleType;
import com.solution.service.UserRolePermissionService;
import com.solution.util.ServiceLocator;

public class UserRolePermissionServiceDelgate implements UserRolePermissionService {

	UserRolePermissionService userRolePermissionService ;
	
	public UserRolePermissionServiceDelgate() throws DelegateException{
		try {
			userRolePermissionService = (UserRolePermissionService)ServiceLocator.getInstance().getRemoteService("UserRolePermissionService");
		} catch (ServiceLocatorException e) {
			throw new DelegateException(e); 
		}
	}	 
	public UserRoleType create(UserRoleType userRoleType, String[] permissionIDs)
			throws ServiceBeanException {		
		return userRolePermissionService.create(userRoleType, permissionIDs);
	}

	public void delete(Long userRoleTypeID) throws ServiceBeanException {

	}

	public UserRoleType read(Long userRoleTypeID) throws ServiceBeanException {
		return userRolePermissionService.read(userRoleTypeID);
	}

	public UserRoleType update(UserRoleType userRoleType,String permission[])
			throws ServiceBeanException {		
		return userRolePermissionService.update(userRoleType,permission);
	}
	public List<UserPermissionType> getPermissionList()
			throws ServiceBeanException {		
		return userRolePermissionService.getPermissionList();
	}
	public List<UserRoleType> getUserRolesList(String roleName)
			throws ServiceBeanException {
		return userRolePermissionService.getUserRolesList(roleName);
	}
	public List<UserRolePermission> getRolePermissionList(Long roleID)
			throws ServiceBeanException {
		return userRolePermissionService.getRolePermissionList(roleID);
	}
	public List<UserPermissionType> getPermissionListByUserId(Long userID)
			throws ServiceBeanException {
		return userRolePermissionService.getPermissionListByUserId(userID);
	}
	public UserPermissionType createUserPermissionType(
			UserPermissionType userPermissionType) throws ServiceBeanException {
		return userRolePermissionService.createUserPermissionType(userPermissionType);
	}

}
